import { Component } from 'react'
import './app.less'
import Taro from '@tarojs/taro'

class App extends Component {
  taroGlobalData = {
    userInfo: null,
    navHeight: 0,
    top: 0
  }

  componentDidMount() {
    let obj = Taro.getMenuButtonBoundingClientRect()
    Taro.getSystemInfo({
      success: res => {
        //导航高度
        if (res.statusBarHeight > 40) {
          this.taroGlobalData.navHeight = res.statusBarHeight + 26
        }
        else {
          this.taroGlobalData.navHeight = res.statusBarHeight + 46
        }
        console.log(res)
        this.taroGlobalData.top = obj.top
      }, fail(err) {
        console.log(err);
      }
    })
  }

  componentDidShow() { }

  componentDidHide() { }

  componentDidCatchError() { }

  // this.props.children 是将要会渲染的页面
  render() {
    return this.props.children
  }
}

export default App
